program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  arr=array of integer;
var
  mass: array of arr;
  n, m, a, b, i, j: integer;
  fin, fout: textfile;
begin
  assignfile(fin, 'input.txt');
  reset(fin);
  assignfile(fout, 'output.txt');
  rewrite(fout);
  readln(fin, n, m);
  setlength(mass, n);
  for i:=0 to n-1 do
    setlength(mass[i], n);
  for i:=0 to n-1 do
    for j:=0 to n-1 do
      mass[i, j]:=0;
  for i:=0 to m-1 do
  begin
    readln(fin, a, b);
    mass[a-1, b-1]:=1;
    mass[b-1, a-1]:=1;
  end;
  for i:=0 to n-1 do
  begin
    for j:=0 to n-1 do
      write(fout, mass[i, j], ' ');
    writeln(fout);
  end;
  closefile(fin);
  closefile(fout);
end.
